\documentclass[]{asl11m02}

\usepackage{graphicx}

\captionsetup{labelfont={bf}}

\author{Giulio Valente, Thomas Selber and Stefano Pongelli}

\title{Web Engineering - Exercise 4}
\subtitle{Woodle, a WordPress course management plugin}
\versiondate{\today}

\begin{committee}
%With more than 1 advisor an error is raised...: only 1 advisor is allowed!
\professor[ETHZ, Switzerland]{Prof.}{Moira}{C.Noirre}

%You can comment out  these lines if you don't have any assistant
\assistant[ETHZ, Switzerland]{}{Michael Nebeling,}{Matthias Geel and Stefania
Leone}
\end{committee}

\abstract {This document is intended to describe the work we have done to 
implement a course management plugin for WordPress. In the first part we
describe the architectural aspects and design choices of the plugin, later we
provide a detailed description that explains how the plugin works and how to
use it. Finally, we offer some observations about creating plugins for WordPress in general. }

\begin{document}
\maketitle
\tableofcontents
\clearpage

%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
In this paper we discuss the structure of the WordPress course management plugin we
created for the Web Engineering course. Starting from a description of the different files 
composing the project architecture, we then continue with an explanation of 
its functionalities. Moreover, we provide some instructions on how to integrate this plugin in a WordPress 
website and how to access all the available functions. We conclude offering some insights into creating WordPress plugins in general.

\section{Plugin Architecture}
This plugin is divided into two distinct parts. 
The front-end is accessible by everybody: it consists of a list of courses taking place in the current year, that are divided per semester (fall and spring).
Each course can be navigated into, and all its information (description, schedule, lectures, material) can be consulted in a clear and simple manner.
The back-end is accessible by the course administrators (teachers and assistants): here we provide a wide range of administrative tasks from a menu
located inside the management panel of WordPress. \\

\noindent Furthermore, we used a number of WordPress ``hooks'' and ``actions'':
\begin{description}
\item[register\_activation\_hook]~\\
to execute functions on activation, for instance for automatically creating a WordPress page with the plugin;
\item[register\_deactivation\_hook]~\\
to execute functions on deactivation, e.g. removing the created page and database tables;
\item[add\_action]~\\
to provide custom actions, e.g. we added the ``wp\_head'' action to add information in the header;
\item[add\_shortcode]~\\
to add a shortcode reference used to display the plugin inside a WordPress page;
\item[wp\_enqueue\_script]~\\
to add javascript functionality;
\item[wp\_enqueue\_style]~\\
to add CSS style information
\end{description}

\subsection{Shared files}
Files used both by the administrative part and the front page are located at the
root of the ``php'' plugin folder. One file, namely ``woodle\_install.class.php'', contains
the class responsible for initializing and installing the plugin into the WordPress framework. This process 
includes the creation of three tables (model) which are better described in the next section. 
The other shared file is the database management class ``woodle\_db\_manager.class.php", which is responsible for managing all the interaction of the 
application with the stored information.

\subsection{Model}
The data necessary to organize the different courses is stored and organized
with the support of the database, for this purpose we have created three
additional table:
\begin{enumerate}
  \item woo\_course stores the information of all the courses
  \item woo\_lecture contains the information of lecture. Each one is referred
  to a ourse.
  \item woo\_material has the material of the lectures. A material can
  be an assignment, a solution, a lecture or a tutorial. A reference to the
  ``posts'' wordpress table is used to keep track of the uploaded file.
\end{enumerate}
Thee three tables can be considered as the model of our plugin, which are
managed with the support of the database manager class
``woodle\_db\_manager.class.php''. An instance of this object is created when
the plugin is loaded and then its reference is used globally, in this way we
provide to the view an easy way to interact with the stored data.

\subsection{Front-end}
The code needed to generate the front page of this project is located inside the ``php/front'' folder. Depending 
on the amount and name of the arguments passed with the GET request, a different kind 
of page is generated: for instance if we request a specific ``course\_id'', the
generated page shows information about that particular course; if we add a ``lecture\_id'' we receive information about the specific lecture and attached materials. 
Moreover, the combination of a css file named ``style.css'', in addition to the javascript code contained in ``script.js'' and the jQuery 
library, provide a pleasing visual user experience and advanced functionalities.

\subsection{Back-end}
To easily manage the courses we decided to implement an administrative interface in the back-end.
In order to do so, we added a custom menu to the already available WordPress dashboard which provides a working and secure access control. 
The files composing the administrative part of the plugin are located in the ``php/admin'' sub directory: the most important 
file, ``woodle\_admin.php'', receives all the input requests and decides which page to include and to show, depending on the ``action'' 
parameter passed along with the request. Furthermore, requests that need database access will access an object of the database manager class described in the Shared files section. 

\section{Functionalities}
The result is an item named ``Woodle'' in the WordPress dashboard menu, pressing it will show a 
similar structure described in the View section but with the possibility to add,
edit or remove content.

\section{Conclusion}


\end{document}